using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

/**
*@file       PosLogicTransferReciever.cs
*@brief      process message PosLogicTransfer
*
*@author     graywind
*@version    1.0.0.1
*@data       2012/3/22
*/

//process PosLogicTransfer
public class OnPosLogicTransfer
{
    /// <summary>
    /// process message
    /// </summary>
    /// <param name="op">message operator</param>
    /// <param name="session_id">session identifier</param>
    /// <param name="msg_buffer">message buffer</param>
    /// <param name="msg_bytes">buffer length</param>
    public static void OnMapping(IMessageOperator op, Int32 session_id, byte[] msg_buffer, UInt32 msg_bytes)
    {
        //TODO
		poslogictransfer.PosLogicTrasfer trans = ProtoNet<poslogictransfer.PosLogicTrasfer>.CreateFromBytes(msg_buffer, msg_bytes);
        int server_session = op.PosServerGroupInfo.GetSessionId(trans.WorldId);
        if (server_session != NetLib.INVALID_SESSION)
        {
			poslogic.PosLogicMain mainMsg = ProtoNet<poslogic.PosLogicMain>.CreateFromBytes(trans.Buffer, (UInt32)trans.Buffer.Length);
			ProtoNet<poslogic.PosLogicMain>.Send(server_session, (uint)NetMessageTypes.MessageType.PosLogic, mainMsg);
        }
    }
}

//register callback
partial class MessageProcTypes<ProcType, MessageProc>
{
        [MessageProcType((int)NetMessageTypes.MessageType.PosLogicTransfer)]
        public static NetMessageProcessor.NetMessageTabFunc PosLogicTransferProc = new NetMessageProcessor.NetMessageTabFunc(OnPosLogicTransfer.OnMapping);
}
